//
//  Area.cpp
//  AntSimulation
//
//  Created by Robert Mayr on 24.10.12.
//  Copyright (c) 2012 Robert Mayr. All rights reserved.
//


#include "Area.h"
#include <string>

Area::Area() {
    east = NULL;
    west = NULL;
    north = NULL;
    south = NULL;
};

Area::~Area() {};

Area* Area::get_east() {
    return east;
}

Area* Area::get_west() {
    return west;
}

Area* Area::get_north() {
    return north;
}

Area* Area::get_south() {
    return south;
}

void Area::set_east(Area* pArea) {
    east = pArea;
}

void Area::set_west(Area* pArea) {
    west = pArea;
}

void Area::set_north(Area* pArea) {
    north= pArea;
}

void Area::set_south(Area* pArea) {
    south = pArea;
}

void Area::AddToListFront(Item* pItem) {
    if(pItem == NULL) return;
    
    items.push_front(pItem);
}

void Area:: AddToListBack(Item* pItem) {
    if(pItem == NULL) return;
    
    items.push_back(pItem);
}

void Area::RemoveFromListFront() {
    items.pop_front();
}

void Area::RemoveFromListBack() {
    items.pop_back();
}

void Area::PrintInfo() {
    Details::PrintInfo();  // print base-information, add Area-Information
    std::cout << "east:" << get_east() << ", west:" << get_west() << ", north:"
        << get_north() << ", south:" << get_south() << "\n\n";
}

void Area::PrintViewable(char cWhat) {
    switch (cWhat) {
        // north
        case 'n': std::cout << " ----------- " << " " << get_north() << (get_north()==NULL ? "00000000 " : " ") << " ----------- "; break;
        // center
        case 'c': std::cout << " " << get_west() << (get_west()==NULL ? "00000000 " : " ") << " " << this << " " << " " << get_east() << (get_east()==NULL ? "00000000 " : " "); break;
        // south
        case 's': std::cout << " ----------- " << " " << get_south() << (get_south()==NULL ? "00000000 " : " ") << " ----------- "; break;

        default: break;
    }
}



